package com.lxyk.yygh.oss.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.lxyk.yygh.common.result.Result;
import com.lxyk.yygh.oss.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/oss/file")
public class FileController {

    @Autowired
    private FileService fileService;

    //上传图片,返回访问路径
    @PostMapping("/fileUpload")
    public Result upload(MultipartFile file){
        String url=fileService.upload(file);
        return Result.ok(url);
    }
}
